package com.maoye.ossp.biz.brand.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.maoye.ossp.biz.brand.entity.BrandMktshare;
import com.maoye.ossp.biz.brand.service.IBrandMktshareService;
import com.maoye.ossp.common.web.BaseController;

/**
 * 对象功能:品牌品类关系表 控制器类
 * 开发公司:maoye shenzhen
 * 开发人员:harry
 * 创建时间:2013-09-30 11:23:41
 */
@Controller
@RequestMapping("/biz/brand/brandmktshare/")
public class BrandMktshareController extends BaseController
{
	@Resource
	private IBrandMktshareService brandMktshareService;
	
	/**
	 * 添加或更新品牌品类信息
	 * @param brandLevel
	 * @param model
	 * @param redirectAttributes
	 * @return
	 */
	@RequestMapping(value = "save")
	public String save(BrandMktshare brandMktshare, Model model,
			RedirectAttributes redirectAttributes,HttpServletRequest request) 
	{
		brandMktshareService.saveData(brandMktshare);
		//return add(brandMktshare,model,request);
		return "redirect:/biz/brand/branddemand/add";
	}
	
	@RequestMapping(value = "add")
	public String add(BrandMktshare brandMktshare, Model model,HttpServletRequest request)
	{
		//TODO
		//根据cateID 联动：品牌风格、品牌价格带。判断为配套类：展示客单价、月消费频次、品牌知名度、
		//其它基本工程要求。
		//Long cateId = brandCate.getCateId();
		brandMktshare = brandMktshareService.getById(null);
		model.addAttribute("brandMktshare", brandMktshare);
		return "/biz/brand/brandmktshare/add";
	}
	
	@RequestMapping(value = "{id}/edit")
	public String edit(@PathVariable String id, Model model,HttpServletRequest request)
	{
		BrandMktshare brandMktshare = brandMktshareService.getById(null);
		model.addAttribute("brandMktshare", brandMktshare);
		return "/biz/brand/brandmktshare/add";
	}
}
